//
//  FoodCell.m
//  HealthA段
//
//  Created by MrJXT on 15/6/4.
//  Copyright (c) 2015年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "FoodCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEUGHT self.contentView.frame.size.height
@implementation FoodCell
- (void)dealloc
{
    [_foodLabel release];
    [_tagView release];
    [_backView release];
    [_tagLabel release];
    [_nameLabel release];
    [_picView release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.backView];
        [_backView release];
        
        self.tagLabel = [[UILabel alloc]init];
        [self.backView addSubview:self.tagLabel];
        [_tagLabel release];
        
        self.nameLabel = [[UILabel alloc]init];
        [self.backView addSubview:self.nameLabel];
        [_nameLabel release];
        
        self.picView = [[UIImageView alloc]init];
        [self.backView addSubview:self.picView];
        [_picView release];
        
        self.tagView = [[UIImageView alloc]init];
        [self.backView addSubview:self.tagView];
        [_tagView release];
        
        self.foodLabel = [[UILabel alloc]init];
        [self.backView addSubview:self.foodLabel];
        [_foodLabel release];
    }
    return self;
}

//试图布局
-(void)layoutSubviews
{
    self.backView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    self.backView.backgroundColor = [UIColor whiteColor];
    self.backView.layer.borderWidth = 0.3;
    self.backView.layer.cornerRadius = 10;
//    self.backView.layer.masksToBounds = YES;
//    self.backView.layer.borderColor = [UIColor clearColor].CGColor;
    self.picView.frame = CGRectMake(5, 5, WIDTH / 4, 110);
    self.picView.layer.borderWidth = 3;
    self.picView.layer.cornerRadius = 24;
    self.picView.layer.masksToBounds = YES;
    self.picView.layer.borderColor = [UIColor clearColor].CGColor;
    self.nameLabel.frame = CGRectMake(WIDTH / 4 + 10, 5, WIDTH - WIDTH / 4, 40);
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
//    self.nameLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:17];
    self.nameLabel.font = [UIFont systemFontOfSize:18];
    self.tagLabel.frame = CGRectMake(WIDTH / 4 + 40, 40, WIDTH - WIDTH / 4, 40);
    self.tagLabel.alpha = 0.76;
    
    self.tagView.frame = CGRectMake(WIDTH / 4 + 10, 50, 20, 20);
    self.tagView.image = [UIImage imageNamed:@"iconfont-biaoqian"];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
